<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
request.setAttribute("contextPath",request.getContextPath());
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'index.jsp' starting page</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script type="text/javascript" src="${contextPath}/js/jquery-1.7.2.js"></script>
	<script type="text/javascript">
		$(document).ready(function (){
			var $submitButton = $("#submitButton");
			var $loginTip = $("#loginTip");
			var $username = $("#username");
			var $password = $("#password");
			$loginTip.css("color","red");
			$username.focus(function(){
				$loginTip.text("");
			});
			$password.focus(function(){
				$loginTip.text("");
			});
			
			$submitButton.click(function(){
				if($username.val() == ""){
					$loginTip.text("请填写用户名");	
					return;
				}
				if($password.val() == ""){
					$loginTip.text("请填写密码");	
					return;
				}
				$("#loginForm").submit();
				$username.val("");
				$password.val("");
			});
		});
	</script>
  </head>
  
  <body>
  		<a href="">首页</a>
    	<form id="loginForm" action="login" method="post">
		     <table border="1">
		     	<tr>
		     		<td>用户名:</td><td><input id="username" name="username" type="text"></td>
		     	</tr>
		     	<tr>	
		     		<td>密码:</td><td><input id="password" name="password" type="password" ></td>
		     	</tr>
		     	<tr>
		     		<td><input id="submitButton" type="button" value="登陆"></td><td id="loginTip">${status}</td>
		     	</tr>
		     </table>
	     </form>
	     
  </body>
</html>
